using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MyProjectile : MonoBehaviour
{
    Rigidbody2D rbody;
    // Start is called before the first frame update
    void Awake()
    {
        rbody = GetComponent<Rigidbody2D>();
        Destroy(this.gameObject, 2f);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    public void Move(Vector2 direction, float Force)
    {
        rbody.AddForce(direction * Force);
    }
    private void OnCollisionEnter2D(Collision2D other)
    {
        MyEnemy ec = other.collider.GetComponent<MyEnemy>();
        if(ec!=null)
        {
            ec.Fixed();
        }
        Destroy(this.gameObject);
    }
}
